package com.qf.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qf.pojo.DtsFootprint;
import com.qf.pojo.DtsSearchHistory;
import com.qf.service.DtsAdminHistoryService;
import com.qf.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/admin/history")
public class DtsAdminHistoryController {

    @Autowired
    DtsAdminHistoryService adminHistoryService;

    @RequestMapping("/list")
    public Object list(@RequestParam(value = "page",required = false,defaultValue = "1") Integer page,
                       @RequestParam(value = "limit",required = false,defaultValue = "10") Integer limit,
                       String sort, String order,String keyword,Integer userId){

        IPage<DtsSearchHistory> iPage = adminHistoryService.queryPage(page,limit,sort,order,keyword,userId);
        Map<String,Object> data = new HashMap<>();
        data.put("total",iPage.getTotal());
        data.put("items",iPage.getRecords());
        return ResponseUtil.ok(data);
    }
}
